{% extends "level_base.html" %}

{% block form %}
  {% if information %}
    <br/>
    <h4>Instructions:</h4>
    {{ information }}
  {% endif %}
  <h5>What is your bet?</h5>
  <form action="/level2" method="post" name="bet_form" onsubmit="return checkBet();">
    {% if new_bet %}
      <div id="bet_div"><input type="text" name="bet" value="{{ new_bet }}" /></div>
    {% else %}
      <div id="bet_div"><input type="text" name="bet" value="1" /></div>
    {% endif %}
    <div><input type="submit" name="submit_button" value="Submit"></div>
  </form>
{% endblock form %}

{% block result %}
  {% if result_message %}
    <table>
      <tr>
        <td>
          <h5>This is your hand:</h5>
          {% for image in images %}
            <img src="{{ image }}" />
            {% if forloop.last %}
              <br />
            {% endif %}
          {% endfor %}
          <h5>{{ result_message }}</h5>
          <h6>Since you bid {{ bet }}, you {{ won }} {{ delta }}</h6>
        </td>
        <td>
          <h5>This is the table of payoffs:</h5>
          <table>
            <tr>
              <th>
                Combination
              </th>
              <th>
                Payoff
              </th>
            </tr>
            {% for outcome in outcomes %}
              <tr>
                <td>
                  {{ outcome.0 }}
                </td>
                <td>
                  {{ outcome.1 }}
                </td>
              </tr>
            {% endfor %}
          </table>
        </td>
      </tr>
    </table>
  {% endif %}
{% endblock result %}